package com.qiqi.mealordersystem.Controller;

import com.qiqi.mealordersystem.Service.SystemUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import static org.springframework.web.bind.annotation.RequestMethod.*;

@Controller
@RequestMapping("systemuser")
public class SystemUserController {

    private SystemUserService service;

    @Autowired
    public SystemUserController(SystemUserService service) {
        this.service = service;
    }

    @RequestMapping( method = PUT)
    public @ResponseBody String addUser(@RequestBody String userString){
        return service.addUser(userString);
    }

    @RequestMapping( method = PATCH)
    public @ResponseBody String updateUser(@RequestBody String userString){
        return service.updateUser(userString);
    }

    @RequestMapping( method = DELETE)
    public @ResponseBody String deleteUser(@RequestBody String userString){
        return service.deleteUser(userString);
    }

    @RequestMapping(method = POST)
    public @ResponseBody String selectUser(@RequestBody String userString){
        return service.ShowUserDtail(userString);
    }

    @RequestMapping(value = "/getusers", method = POST)
    public @ResponseBody String selectUsers(@RequestBody String users){
        return null;
    }

}
